package com.neusoft.chanceserver.controller;


import com.neusoft.chanceserver.dto.RespBean;
import com.neusoft.chanceserver.dto.SubchanceAdd;
import com.neusoft.chanceserver.entity.Subchance;
import com.neusoft.chanceserver.service.ISubchanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 子机会表 前端控制器
 * </p>
 *
 * @author liuxp
 * @since 2021-07-12
 */
@RestController
@RequestMapping("/chance")
public class SubchanceController {

    @Autowired
    ISubchanceService iSubchanceService;

    @PostMapping("/searchSubchance/{chanceId}")
    RespBean searchSubchanceByChanceId(@PathVariable Integer chanceId){
        return iSubchanceService.searchSubchanceByChanceId(chanceId);
    }

    @PostMapping("/deleteSubchance/{subchanceId}")
    RespBean deleteSubchance(@PathVariable Integer subchanceId){
        System.out.println(subchanceId);
        return iSubchanceService.deleteSubchance(subchanceId);
    }

    @PostMapping("/updateSubchance")
    RespBean updateSubchance(@RequestBody Subchance subchance){
        return iSubchanceService.updateSubchance(subchance);
    }

    @PostMapping("/addSubchance")
    RespBean addSubchance(@RequestBody SubchanceAdd subchanceAdd){
        return iSubchanceService.addSubchance(subchanceAdd);
    }
}

